import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yang
 * Date: 2022-06-07
 * Time: 14:18
 */
/*class MyArray<T> {
    public T[] array = (T[])new Object[10];//1

    public T[] array1 = T[10];
    public  Object[] array2 = new Object[10];

    public T getPos(int pos) {
        return this.array[pos];
    }

    public void setVal(int pos,T val) {
        this.array[pos] = val;
    }
}*/
class MyArray<T> {
    public T[] array;

    public MyArray(Class<T> clazz, int capacity) {
        array = (T[]) Array.newInstance(clazz, capacity);
    }
    public T getPos(int pos) {
        return this.array[pos];
    }
    public void setVal(int pos,T val) {
        this.array[pos] = val;
    }
    public T[] getArray() {
        return array;
    }
}

public interface Comparable<T>{
    int CompareTo(T other);
}


public class Main {
    public static void main(String[] args) {
        MyArray<Integer> myArray1 = new MyArray<>(Integer.class,10);
        myArray1.setVal(0,10);
        Integer[] integers = myArray1.getArray();
        System.out.println(Arrays.toString(integers));


    }
}
